import http from "@/utils/request"

export default {
    getProductOrderStat() {
        return http.get('/product/order/stat')
    },
    getProductOrderInfo(productOrderId) {
        return http.get('/product/order', {params: {productOrderId}})
    },
    /**
     * 创建订单
     * @param data
     * @returns {Promise<axios.AxiosResponse<any>>}
     */
    createProductOrder(data) {
        return http.post('/orders/add', data)
    },
    /**
     * 确认发货
     * @param orderId
     * @returns {Promise<axios.AxiosResponse<any>>}
     */
    shipments(orderId) {
        return http.post(`/orders/shipped/${orderId}`)
    },

    /**
     * 确认收货
     * @param orderId
     * @returns {Promise<axios.AxiosResponse<any>>}
     */
    receipt(orderId) {
        return http.post(`/orders/receipt/${orderId}`)
    },

    userSelfProduct(productOrderId) {
        return http.put('/product/order/user/self/' + productOrderId)
    },
    postProductOrder(data) {
        return http.put('/product/order/post', data)
    },
    postSelfProductOrder(data) {
        return http.put('/product/order/selfPost', data)
    },
    confirmPost(productOrderId) {
        return http.put('/product/order/post/confirm/' + productOrderId)
    },
    getProductOrderDetail(orderId) {
        return http.get(`/orders/detail/${orderId}`)
    },
    evaluateOrder(data) {
        return http.put('/product/order/evaluate', data)
    }
}
